package com.hspedu.enum_;

/**
 * @author sp
 * @version 0.1
 *
 */
public class EnumExercise02 {
    public static void main(String[] args) {
        System.out.println("==所有星期的信息如下==");
        Week[] values = Week.values();
        for (int i = 0; i < values.length; i++) {
            System.out.println(values[i]);
        }
    }
}


/**声明Week枚举类，其中包含星期一至星期日的定义：
 * MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
 */

enum Week{
    MONDAY("星期一"),
    TUESDAY("星期二"),
    WEDNESDAY("星期三"),
    THURSDAY("星期四"),
    FRIDAY("星期五"),
    SATURDAY("星期六"),
    SUNDAY("星期日");


    private String desc;

    private Week(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    //重写toString方法，使其能打印desc
    @Override
    public String toString() {
        return desc;
    }
}